﻿/**
* QSmart Andon
*
* 2013-10-12
* 2013-10-16日有更新ExportETypeDetail导出excel方法 
* 
* steven.li
*
* Copyright(c) 2013 All Rights Reserved. Taiyou Tech(GUANGZHOU) Co.,Ltd.  (广州太友科技) [ sales@gztaiyou.com]. 
*
*/
using System;
using System.Reflection;
using System.Text;
using System.Web;
using FX.CC.Andon.Business.BasicDataManage;
using FX.CC.Andon.Entity.BasicDataManage;
using FX.CC.Andon.Utility.Common;

namespace FX.CC.Andon.WebSite.Service
{
    /// <summary>
    /// BasicDataManageHandler 的摘要说明
    /// </summary>
    public class BasicDataManageHandler : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            try
            {
                var action = DtRequest.GetQueryString("action");
                if (string.IsNullOrEmpty(action)) return;
                var method = this.GetType().GetMethod(action);
                if (method == null) return;
                object[] parameters = { context };
                method.Invoke(this, parameters);
            }
            catch (Exception ex)
            {
                EventsLog.WriteLog("ErrorInfo" + ex.Message);
            }

        }

        #region 汇报层级定义
        public void GetLevelList(HttpContext context)
        {
            var bll = new LevelBusiness();
            var qcmodel = new LevelQcEntity
            {
                ETypeCode = context.Request["ETypeCode"],
                LineID = context.Request["LineID"],
                TimeoutStatus = context.Request["TimeoutStatus"],
                PageIndex = Convert.ToInt32(context.Request["pageIndex"]),
                PageSize = Convert.ToInt32(context.Request["pageSize"]),
                SortField = context.Request["sortField"],
                SortOrder = context.Request["sortOrder"]
            };
            var json = bll.GetLevelList(qcmodel);
            context.Response.Write(json);
            context.Response.End();
        }
        public void GetLevelDetailList(HttpContext context)
        {
            var bll = new LevelDetailBusiness();
            var qcmodel = new LevelDetailQcEntity
            {
                LvID = context.Request["LvID"],
                PageIndex = Convert.ToInt32(context.Request["pageIndex"]),
                PageSize = Convert.ToInt32(context.Request["pageSize"]),
                SortField = context.Request["sortField"],
                SortOrder = context.Request["sortOrder"]
            };
            var json = bll.GetLevelDetailList(qcmodel);
            context.Response.Write(json);
            context.Response.End();
        }
        public void GetLevelDetailListByLvInfo(HttpContext context)
        {
            var bll = new LevelDetailBusiness();
            var qcmodel = new LevelDetailQcEntity
                              {
                                  LvID = context.Request["LvID"],
                                  LevelIdx = context.Request["LevelIdx"]
                              };
            if (string.IsNullOrEmpty(qcmodel.LvID) || string.IsNullOrEmpty(qcmodel.LevelIdx)) return;
            var json = bll.GetLevelDetailListByLvInfo(qcmodel);
            context.Response.Write(json);
            context.Response.End();
        }
        public void GetLevelInfo(HttpContext context)
        {
            var lvId = context.Request["LvID"];
            if (String.IsNullOrEmpty(lvId)) return;
            var json = new LevelBusiness().GetLevelInfo(lvId);
            context.Response.Write(json);
            context.Response.End();
        }
        public void GetMaxLevelIdx(HttpContext context)
        {
            var bll = new LevelBusiness();
            var qcmodel = new LevelQcEntity
            {
                ETypeCode = context.Request["ETypeCode"],
                LineID = context.Request["LineID"],
                TimeoutStatus = context.Request["TimeoutStatus"]
            };
            if (string.IsNullOrEmpty(qcmodel.ETypeCode) && string.IsNullOrEmpty(qcmodel.LineID)) return;
            var json = bll.GetMaxLevelIdx(qcmodel);
            context.Response.Write(json);
            context.Response.End();
        }
        public void GetMaxLevelIdxs(HttpContext context)
        {
            var bll = new LevelBusiness();
            var qcmodel = new LevelQcEntity
            {
                ETypeCode = context.Request["ETypeCode"],
                LineID = context.Request["WSID"],
                TimeoutStatus = context.Request["TimeoutStatus"]
            };
            if (string.IsNullOrEmpty(qcmodel.ETypeCode) && string.IsNullOrEmpty(qcmodel.LineID) && string.IsNullOrEmpty(qcmodel.TimeoutStatus)) return;
            var json = bll.GetMaxLevelIdxs(qcmodel);
            context.Response.Write(json);
            context.Response.End();
        }
        public void RemoveLevel(HttpContext context)
        {
            var id = context.Request["LvID"];
            if (string.IsNullOrEmpty(id)) return;
            var json = new LevelBusiness().RemoveLevel(id);
            context.Response.Write(json);
            context.Response.End();
        }
        public void AddLevel(HttpContext context)
        {
            var data = context.Request["data"];
            new LevelBusiness().AddLevel(data);
        }
        public void ModifyLevel(HttpContext context)
        {
            var data = context.Request["data"];
            new LevelBusiness().ModifyLevel(data);
        }


        #endregion

        #region 异常类别
        public void GetETypeList(HttpContext context)
        {
            var bll = new ETypeBusiness();
            var qcmodel = new ETypeQcEntity
            {
                RecStatus = context.Request["RecStatus"],
                PageIndex = Convert.ToInt32(context.Request["pageIndex"]),
                PageSize = Convert.ToInt32(context.Request["pageSize"]),
                SortField = context.Request["sortField"],
                SortOrder = context.Request["sortOrder"]
            };
            var json = bll.GetETypeList(qcmodel);
            context.Response.Write(json);
            context.Response.End();
        }
        public void GetETypeListByCombobox(HttpContext context)
        {
            var json = new ETypeBusiness().GetETypeList();
            context.Response.Write(json);
            context.Response.End();
        }
        public void AddEType(HttpContext context)
        {
            var data = context.Request["data"];
            new ETypeBusiness().AddEType(data);
        }
        public void ModifyEType(HttpContext context)
        {
            var data = context.Request["data"];
            new ETypeBusiness().ModifyEType(data);
        }
        public void GetETypeInfo(HttpContext context)
        {
            var id = context.Request["ETypeCode"];
            if (string.IsNullOrEmpty(id)) return;
            var json = new ETypeBusiness().GetETypeInfo(id);
            context.Response.Write(json);
            context.Response.End();
        }

        #endregion

        #region 车间
        public void GetWorkShopList(HttpContext context)
        {
            var bll = new WorkShopBusiness();
            var qcmodel = new WorkShopQcEntity
            {
                RecStatus = context.Request["RecStatus"],
                PageIndex = Convert.ToInt32(context.Request["pageIndex"]),
                PageSize = Convert.ToInt32(context.Request["pageSize"]),
                SortField = context.Request["sortField"],
                SortOrder = context.Request["sortOrder"]
            };
            var json = bll.GetWorkShopList(qcmodel);
            context.Response.Write(json);
            context.Response.End();
        }
        public void GetWorkShopListByCombobox(HttpContext context)
        {
            var json = new WorkShopBusiness().GetWorkShopList();
            context.Response.Write(json);
            context.Response.End();
        }
        public void AddWorkShop(HttpContext context)
        {
            var data = context.Request["data"];
            new WorkShopBusiness().AddWorkShop(data);
        }
        public void ModifyWorkShop(HttpContext context)
        {
            var data = context.Request["data"];
            new WorkShopBusiness().ModifyWorkShop(data);
        }
        public void GetWorkShopInfo(HttpContext context)
        {
            var id = context.Request["WSID"];
            if (string.IsNullOrEmpty(id)) return;
            var json = new WorkShopBusiness().GetWorkShopInfo(id);
            context.Response.Write(json);
            context.Response.End();
        }

        #endregion

        #region 设备
        public void GetEquipmentListByCombobox(HttpContext context)
        {
            var bll = new EquipmentBusiness();
            var qcmodel = new EquipmentQcEntity
            {
                LineID = context.Request["LineID"]
            };
            var json = bll.GetEquipmentListByCombobox(qcmodel);
            context.Response.Write(json);
            context.Response.End();
        }
        public void GetEquipmentListById(HttpContext context)
        {
            var bll = new EquipmentBusiness();
            var qcmodel = new EquipmentQcEntity
            {
                EqCode = context.Request["EqCode"],
                EqName = context.Request["EqName"],
                LineID = context.Request["LineID"],
                PageIndex = Convert.ToInt32(context.Request["pageIndex"]),
                PageSize = Convert.ToInt32(context.Request["pageSize"]),
                SortField = context.Request["sortField"],
                SortOrder = context.Request["sortOrder"]
            };
            var json = bll.GetEquipmentList(qcmodel);
            context.Response.Write(json);
            context.Response.End();
        }
        public void AddEquipment(HttpContext context)
        {
            var data = context.Request["data"];
            new EquipmentBusiness().AddEquipment(data);
        }
        public void ModifyEquipment(HttpContext context)
        {
            var data = context.Request["data"];
            new EquipmentBusiness().ModifyEquipment(data);
        }
        public void GetEquipmentInfo(HttpContext context)
        {
            var id = context.Request["EqID"];
            if (string.IsNullOrEmpty(id)) return;
            var json = new EquipmentBusiness().GetEquipmentInfo(id);
            context.Response.Write(json);
            context.Response.End();
        }
        public void ImportEq(HttpContext context)
        {
            string tmpRootDir = context.Server.MapPath(context.Request.ApplicationPath);//获取程序根目录
            var data = context.Request["data"];
            new EquipmentBusiness().ImportEq(tmpRootDir, data);
        }
        /// <summary>
        /// 验证Equipment
        /// </summary>
        /// <param name="context"></param>
        public void GetEquipmentCheckEqCode(HttpContext context)
        {
            var id = context.Request["EqCode"];
            if (string.IsNullOrEmpty(id)) return;
            var json = new EquipmentBusiness().GetCheckEqCode(id);
            context.Response.Write(json);
            context.Response.End();
        }


        #endregion

        #region 异常明细类别
        public void GetETypeCategoryListById(HttpContext context)
        {
            var bll = new ETypeCategoryBusiness();
            var qcmodel = new ETypeCategoryQcEntity
            {
                RecStatus = context.Request["RecStatus"],
                ETypeCode = context.Request["ETypeCode"],
                PageIndex = Convert.ToInt32(context.Request["pageIndex"]),
                PageSize = Convert.ToInt32(context.Request["pageSize"]),
                SortField = context.Request["sortField"],
                SortOrder = context.Request["sortOrder"]
            };
            var json = bll.GetETypeCategoryList(qcmodel);
            context.Response.Write(json);
            context.Response.End();
        }
        public void AddETypeCategory(HttpContext context)
        {
            var data = context.Request["data"];
            new ETypeCategoryBusiness().AddETypeCategory(data);
        }
        public void ModifyETypeCategory(HttpContext context)
        {
            var data = context.Request["data"];
            new ETypeCategoryBusiness().ModifyETypeCategory(data);
        }
        public void GetETypeCategoryInfo(HttpContext context)
        {
            var id = context.Request["CatID"];
            if (string.IsNullOrEmpty(id)) return;
            var json = new ETypeCategoryBusiness().GetETypeCategoryInfo(id);
            context.Response.Write(json);
            context.Response.End();
        }
        #endregion

        #region 异常分类管理
        public void GetETypeDetailListById(HttpContext context)
        {
            var bll = new ETypeDetailBusiness();
            var qcmodel = new ETypeDetailQcEntity
            {
                RecStatus = context.Request["RecStatus"],
                CatID = context.Request["CatID"],
                DetailCode = context.Request["DetailCode"],
                DetailName = context.Request["DetailName"],
                PageIndex = Convert.ToInt32(context.Request["pageIndex"]),
                PageSize = Convert.ToInt32(context.Request["pageSize"]),
                SortField = context.Request["sortField"],
                SortOrder = context.Request["sortOrder"]
            };
            var json = bll.GetETypeDetailList(qcmodel);
            context.Response.Write(json);
            context.Response.End();
        }
        public void AddETypeDetail(HttpContext context)
        {
            var data = context.Request["data"];
            new ETypeDetailBusiness().AddETypeDetail(data);
        }
        public void ModifyETypeDetail(HttpContext context)
        {
            var data = context.Request["data"];
            new ETypeDetailBusiness().ModifyETypeDetail(data);
        }
        public void GetETypeDetailInfo(HttpContext context)
        {
            var id = context.Request["DetailID"];
            if (string.IsNullOrEmpty(id)) return;
            var json = new ETypeDetailBusiness().GetETypeDetailInfo(id);
            context.Response.Write(json);
            context.Response.End();
        }
        /// <summary>
        /// 异常明细导入
        /// </summary>
        /// <param name="context"></param>
        public void ImportETypeDetail(HttpContext context)
        {
            var tmpRootDir = context.Server.MapPath(context.Request.ApplicationPath);//获取程序根目录
            var data = context.Request["data"];
            new ETypeDetailBusiness().ImportETypeDetail(tmpRootDir, data);
        }

        /// <summary>
        /// 异常明细导出Excel
        /// </summary>
        /// <param name="context"></param>
        public void ExportETypeDetail(HttpContext context)
        {
            var str = HttpUtility.UrlDecode(GetQueryBytes(context.Request), Encoding.GetEncoding("gb2312"));
            var arr1 = str.Split('&');
            var catName = arr1[4].Substring(arr1[4].LastIndexOf("=") + 1);
            var eTypeName = arr1[5].Substring(arr1[5].LastIndexOf("=") + 1);
            var bll = new ETypeDetailBusiness();
            var qcmodel = new ETypeDetailQcEntity
            {
                CatID = context.Request["CatID"],
                DetailCode = context.Request["DetailCode"],
                DetailName = context.Request["DetailName"],
            };
            var dt = bll.ExportETypeDetail(qcmodel);
            if (dt.Rows.Count <= 0) return;
            const bool specificTime = true;
            dt.Columns[0].ColumnName = "编号";
            dt.Columns[1].ColumnName = "名称";
            dt.Columns[2].ColumnName = "备注";
            dt.Columns[3].ColumnName = "状态";
            if (dt.Rows.Count > 0)
            {
                ExcelHelper.ExportByWeb(dt, "暗灯系统【" + eTypeName + " - " + catName + "】异常明细", "暗灯系统【" + eTypeName + "-" + catName + "】异常明细.xls", specificTime);
            }
        }

        /// <summary>
        /// 得到原始查询字节码
        /// </summary>
        /// <param name="req"></param>
        /// <returns></returns>
        protected byte[] GetQueryBytes(HttpRequest req)
        {
            var type = req.GetType();
            var property = type.GetProperty("QueryStringBytes",
                BindingFlags.Instance | BindingFlags.IgnoreCase | BindingFlags.NonPublic);
            var queryBytes = (byte[])property.GetValue(req, null);
            return queryBytes;
        }

        #endregion

        #region 异常备注
        public void GetEventRecInfo(HttpContext context)
        {
            var id = context.Request["EventID"];
            if (string.IsNullOrEmpty(id)) return;
            var json = new EventRecBusiness().GetEventRecInfo(id);
            context.Response.Write(json);
            context.Response.End();
        }
        public void ModifyEventRec(HttpContext context)
        {
            var data = context.Request["data"];
            new EventRecBusiness().ModifyEventRec(data);
        }
        #endregion

        #region 求助人员管理
        public void GetReqHelpList(HttpContext context)
        {
            var bll = new ReqHelpBusiness();
            var qcmodel = new ReqHelpQcEntity
            {
                ETypeCode = context.Request["ETypeCode"],
                WSID = context.Request["WSID"],
                PageIndex = Convert.ToInt32(context.Request["pageIndex"]),
                PageSize = Convert.ToInt32(context.Request["pageSize"]),
                SortField = context.Request["sortField"],
                SortOrder = context.Request["sortOrder"]
            };
            var json = bll.GetReqHelpList(qcmodel);
            context.Response.Write(json);
            context.Response.End();
        }

        public void AddReqHelp(HttpContext context)
        {
            var data = context.Request["data"];
            new ReqHelpBusiness().AddReqHelp(data);
        }
        public void ModifyReqHelp(HttpContext context)
        {
            var data = context.Request["data"];
            new ReqHelpBusiness().ModifyReqHelp(data);
        }

        public void RemoveReqHelp(HttpContext context)
        {
            var id = context.Request["ReqID"];
            if (string.IsNullOrEmpty(id)) return;
            var json = new ReqHelpBusiness().RemoveReqHelp(id);
            context.Response.Write(json);
            context.Response.End();
        }
        public void GetReqHelpUsers(HttpContext context)
        {
            var bll = new ReqHelpBusiness();
            var qcmodel = new ReqHelpQcEntity
            {
                ETypeCode = context.Request["ETypeCode"],
                WSID = context.Request["WSID"]
            };
            var json = bll.GetReqHelpUsers(qcmodel);
            context.Response.Write(json);
            context.Response.End();
        }
        #endregion

        #region 上传文件路径获取
        /// <summary>
        /// 上传文件路径获取
        /// </summary>
        /// <param name="context"></param>
        public void fileupload(HttpContext context)
        {
            var json = "";
            // 获得程序路径
            string tempFile = context.Request.PhysicalApplicationPath;
            //找到目标文件对象
            HttpPostedFile uploadFile = context.Request.Files["excUrl"];

            if (uploadFile.ContentLength > 0)
            {
                json = UploadFile.InportUpLoadFile(uploadFile, tempFile);
            }
            context.Response.Write(json);
            context.Response.End();
        }
        #endregion

        #region  产线
        public void GetLineList(HttpContext context)
        {
            var bll = new LineBusiness();
            var qcmodel = new LineQcEntity
            {
                WSID = context.Request["WSID"],
                LineCode = context.Request["LineCode"],
                PageIndex = Convert.ToInt32(context.Request["pageIndex"]),
                PageSize = Convert.ToInt32(context.Request["pageSize"]),
                SortField = context.Request["sortField"],
                SortOrder = context.Request["sortOrder"]
            };
            var json = bll.GetLineList(qcmodel);
            context.Response.Write(json);
            context.Response.End();
        }
        public void GetLineListByCombobox(HttpContext context)
        {
            var json = new LineBusiness().GetLineList();
            context.Response.Write(json);
            context.Response.End();
        }
        public void AddLine(HttpContext context)
        {
            var data = context.Request["data"];
            new LineBusiness().AddLine(data);
        }
        public void ModifyLine(HttpContext context)
        {
            var data = context.Request["data"];
            new LineBusiness().ModifyLine(data);
        }
        public void CheckLineByCode(HttpContext context)
        {
            var bll = new LineBusiness();
            var lineCode = context.Request["LineCode"];
            if (string.IsNullOrEmpty(lineCode)) return;
            var json = bll.CheckLineByCode(lineCode);
            context.Response.Write(json);
            context.Response.End();
        }
        public void GetLineInfo(HttpContext context)
        {
            var id = context.Request["LineID"];
            if (string.IsNullOrEmpty(id)) return;
            var json = new LineBusiness().GetLineInfo(id);
            context.Response.Write(json);
            context.Response.End();
        }
        public void RemoveLine(HttpContext context)
        {
            var id = context.Request["LineID"];
            if (string.IsNullOrEmpty(id)) return;
            var json = new LineBusiness().RemoveLine(id);
            context.Response.Write(json);
            context.Response.End();
        }
        #endregion

        #region 异常邮件通知
        public void GetETypeMailListById(HttpContext context)
        {
            var bll = new ETypeMailBusiness();
            var qcmodel = new ETypeMailQcEntity
            {
                ETypeCode = context.Request["ETypeCode"],
                PageIndex = Convert.ToInt32(context.Request["pageIndex"]),
                PageSize = Convert.ToInt32(context.Request["pageSize"]),
                SortField = context.Request["sortField"],
                SortOrder = context.Request["sortOrder"]
            };
            var json = bll.GetETypeMailListById(qcmodel);
            context.Response.Write(json);
            context.Response.End();
        }
        public void AddETypeMail(HttpContext context)
        {
            var data = context.Request["data"];
            new ETypeMailBusiness().AddETypeMail(data);
        }
        public void ModifyETypeMail(HttpContext context)
        {
            var data = context.Request["data"];
            new ETypeMailBusiness().ModifyETypeMail(data);
        }
        public void GetETypeMailListByETypeCode(HttpContext context)
        {
            var id = context.Request["ETypeCode"];
            if (string.IsNullOrEmpty(id)) return;
            var json = new ETypeMailBusiness().GetETypeMailListByETypeCode(id);
            context.Response.Write(json);
            context.Response.End();
        }
        public void RemoveByRowId(HttpContext context)
        {
            var id = context.Request["RowID"];
            if (string.IsNullOrEmpty(id)) return;
            new ETypeMailBusiness().RemoveByRowId(id);
        }
        #endregion

        #region 班次管理
        public void GetShiftList(HttpContext context)
        {
            var bll = new ShiftBusiness();
            var qcmodel = new ShiftQcEntity
            {
                ShiftName = context.Request["ShiftName"],
                PageIndex = Convert.ToInt32(context.Request["pageIndex"]),
                PageSize = Convert.ToInt32(context.Request["pageSize"]),
                SortField = context.Request["sortField"],
                SortOrder = context.Request["sortOrder"]
            };
            var json = bll.GetShiftList(qcmodel);
            context.Response.Write(json);
            context.Response.End();
        }
        public void GetShiftListByCombobox(HttpContext context)
        {
            var json = new ShiftBusiness().GetShiftListByCombobox();
            context.Response.Write(json);
            context.Response.End();
        }
        public void AddShift(HttpContext context)
        {
            var data = context.Request["data"];
            new ShiftBusiness().AddShift(data);
        }
        public void ModifyShift(HttpContext context)
        {
            var data = context.Request["data"];
            new ShiftBusiness().ModifyShift(data);
        }

        public void GetShiftInfo(HttpContext context)
        {
            var id = context.Request["ShiftID"];
            if (string.IsNullOrEmpty(id)) return;
            var json = new ShiftBusiness().GetShiftInfo(id);
            context.Response.Write(json);
            context.Response.End();
        }
        #endregion

        #region 产品管理
        public void GetProductList(HttpContext context)
        {
            var bll = new ProductBusiness();
            var qcmodel = new ProductQcEntity
            {
                PrdCode = context.Request["PrdCode"],
                PrdName = context.Request["PrdName"],
                PageIndex = Convert.ToInt32(context.Request["pageIndex"]),
                PageSize = Convert.ToInt32(context.Request["pageSize"]),
                SortField = context.Request["sortField"],
                SortOrder = context.Request["sortOrder"]
            };
            var json = bll.GetProductList(qcmodel);
            context.Response.Write(json);
            context.Response.End();
        }

        public void GetProductListByCombobox(HttpContext context)
        {
            var json = new ProductBusiness().GetProductListByCombobox();
            context.Response.Write(json);
            context.Response.End();
        }

        public void GetProductListByQuery(HttpContext context)
        {
            string key = context.Request["key"];
            var json = new ProductBusiness().GetProductListByQuery(key);
            context.Response.Write(json);
            context.Response.End();
        }

        public void AddProduct(HttpContext context)
        {
            var data = context.Request["data"];
            new ProductBusiness().AddProduct(data);
        }
        public void ModifyProduct(HttpContext context)
        {
            var data = context.Request["data"];
            new ProductBusiness().ModifyProduct(data);
        }
        public void GetProductInfo(HttpContext context)
        {
            var id = context.Request["PrdID"];
            if (string.IsNullOrEmpty(id)) return;
            var json = new ProductBusiness().GetProductInfo(id);
            context.Response.Write(json);
            context.Response.End();
        }
        public void CheckFileUpload(HttpContext context)
        {
            var json = "";
            // 获得程序路径
            string tempFile = context.Request.PhysicalApplicationPath;
            //找到目标文件对象
            HttpPostedFile uploadFile = context.Request.Files["CheckFile"];

            if (uploadFile.ContentLength > 0)
            {
                json = UploadFile.UpLoadFile(uploadFile, tempFile);
            }
            context.Response.Write(json);
            context.Response.End();
        }
        public void OpFileUpload(HttpContext context)
        {
            var json = "";
            // 获得程序路径
            string tempFile = context.Request.PhysicalApplicationPath;
            //找到目标文件对象
            HttpPostedFile uploadFile = context.Request.Files["OpFile"];

            if (uploadFile.ContentLength > 0)
            {
                json = UploadFile.UpLoadFile(uploadFile, tempFile);
            }
            context.Response.Write(json);
            context.Response.End();
        }
        public void GetFlowListById(HttpContext context)
        {
            var bll = new ProductBusiness();
            var qcmodel = new ProductQcEntity
            {
                PrdID = context.Request["PrdID"]
            };
            var json = bll.GetFlowListById(qcmodel);
            context.Response.Write(json);
            context.Response.End();
        }
        public void GetFlowInfo(HttpContext context)
        {
            var bll = new ProductBusiness();
            var qcmodel = new ProductQcEntity
            {
                PrdID = context.Request["PrdID"]
            };
            var json = bll.GetFlowInfo(qcmodel);
            context.Response.Write(json);
            context.Response.End();
        }

        //public void GetFlowDocListById(HttpContext context)
        //{
        //    var bll = new ProductBusiness();
        //    var qcmodel = new FlowDocQcEntity
        //    {
        //        FlowID = context.Request["FlowID"],
        //        DocType = context.Request["DocType"]
        //    };
        //    var json = bll.GetFlowDocListById(qcmodel);
        //    context.Response.Write(json);
        //    context.Response.End();
        //}

        #endregion

        #region 生产任务(2014-01-10)
        public void GetPrdTaskList(HttpContext context)
        {
            var bll = new PrdTaskBusiness();
            var qcmodel = new PrdTaskQcEntity
            {
                BizDateFrom = context.Request["BizDateFrom"],
                BizDateEnd = context.Request["BizDateEnd"],
                ShiftID = context.Request["ShiftID"],
                EqID = context.Request["EqID"],
                PrdCode = context.Request["PrdCode"],
                LineID = context.Request["LineID"],
                PageIndex = Convert.ToInt32(context.Request["pageIndex"]),
                PageSize = Convert.ToInt32(context.Request["pageSize"]),
                SortField = context.Request["sortField"],
                SortOrder = context.Request["sortOrder"]
            };
            var json = bll.GetPrdTaskList(qcmodel);
            context.Response.Write(json);
            context.Response.End();
        }
        public void AddPrdTask(HttpContext context)
        {
            var data = context.Request["data"];
            new PrdTaskBusiness().AddPrdTask(data);
        }
        public void ModifyPrdTask(HttpContext context)
        {
            var data = context.Request["data"];
            new PrdTaskBusiness().ModifyPrdTask(data);
        }
        public void GetPrdTaskInfo(HttpContext context)
        {
            var id = context.Request["TaskID"];
            if (string.IsNullOrEmpty(id)) return;
            var json = new PrdTaskBusiness().GetPrdTaskInfo(id);
            context.Response.Write(json);
            context.Response.End();
        }
        public void ImportPrdTask(HttpContext context)
        {
            string tmpRootDir = context.Server.MapPath(context.Request.ApplicationPath);//获取程序根目录
            var data = context.Request["data"];
            new PrdTaskBusiness().ImportPrdTask(tmpRootDir, data);
        }
        #region 工序
        public void GetFlowListByCombobox(HttpContext context)
        {
            var bll = new FlowBusiness();
            var id = context.Request["PrdID"];
            if (string.IsNullOrEmpty(id)) return;
            var json = bll.GetFlowListByCombobox(id);
            context.Response.Write(json);
            context.Response.End();
        }
        #endregion

        #endregion

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}